package com.sh.data.engine.common.enumDefinition;

import java.util.ArrayList;
import java.util.List;

/**
 * @author tinglan.ys
 * @description:
 * @date 2022/2/22 下午5:06
 */
public enum DataQualityRuleCompareTypeEnum {
    GREATER(0, "大于"),
    GREATER_OR_EQUAL(1, "大于等于"),
    EQUAL(2, "等于"),
    LESS(3, "小于"),
    LESS_OR_EQUAL(4, "小于等于"),
    NOT_EQUAL(5, "不等于"),
    BELONG(6, "属于"),
    NOT_BELONG(7, "不属于");

    private Integer compareType;
    private String desc;

    DataQualityRuleCompareTypeEnum(Integer compareType, String desc) {
        this.compareType = compareType;
        this.desc = desc;
    }

    public Integer getCompareType() {
        return compareType;
    }

    public String getDesc() {
        return desc;
    }

    public static DataQualityRuleCompareTypeEnum getByCompareType(Integer compareType) {
        for (DataQualityRuleCompareTypeEnum dataqualityRuleCompareTypeEnum :
            DataQualityRuleCompareTypeEnum.values()) {
            if (dataqualityRuleCompareTypeEnum.compareType.equals(compareType)) {
                return dataqualityRuleCompareTypeEnum;
            }
        }
        return null;
    }

    public static List<DataQualityRuleCompareTypeEnum> normalGroup() {
        List<DataQualityRuleCompareTypeEnum> enums = new ArrayList<>();
        enums.add(GREATER);
        enums.add(GREATER_OR_EQUAL);
        enums.add(EQUAL);
        enums.add(LESS);
        enums.add(LESS_OR_EQUAL);
        enums.add(NOT_EQUAL);
        return enums;
    }

    public static List<DataQualityRuleCompareTypeEnum> belongGroup() {
        List<DataQualityRuleCompareTypeEnum> enums = new ArrayList<>();
        enums.add(BELONG);
        enums.add(NOT_BELONG);
        return enums;
    }
}
